Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| JavaTM 2 Platform Std. Ed. v1.4.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.xml.sax.helpers
Class XMLReaderFactory

    java.lang.Object
      |
      +--org.xml.sax.helpers.XMLReaderFactory

public final class XMLReaderFactory
extends Object

Factory for creating an XML reader.

> This module, both source code and documentation, is in the Public Domain, and comes with NO WARRANTY.

This class contains static methods for creating an XML reader from an explicit class name, or for creating an XML reader based on the value of the `org.xml.sax.driver` system property:

     try {
       XMLReader myReader = XMLReaderFactory.createXMLReader();
     } catch (SAXException e) {
       System.err.println(e.getMessage());
     }

Note that these methods will not be usable in environments where system properties are not accessible or where the application or applet is not permitted to load classes dynamically.

Note to implementors: SAX implementations in specialized environments may replace this class with a different one optimized for the environment, as long as its method signatures remain the same.

Since:
  SAX 2.0
See Also:
  `XMLReader`

Method Summary
`static XMLReader` | `createXMLReader()` Attempt to create an XML reader from a system property.
`static XMLReader` | `createXMLReader(String className)` Attempt to create an XML reader from a class name.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### createXMLReader

    public static XMLReader createXMLReader()
                                     throws SAXException

  Attempt to create an XML reader from a system property.

  This method uses the value of the system property "org.xml.sax.driver" as the full name of a Java class and tries to instantiate that class as a SAX2 XMLReader.

  Note that many Java interpreters allow system properties to be specified on the command line.

  Returns:
    A new XMLReader.
  Throws:
    `SAXException` - If the value of the "org.xml.sax.driver" system property is null, or if the class cannot be loaded and instantiated.
  See Also:
    `createXMLReader(java.lang.String)`

### createXMLReader

    public static XMLReader createXMLReader(String className)
                                     throws SAXException

  Attempt to create an XML reader from a class name.

  Given a class name, this method attempts to load and instantiate the class as an XML reader.

  Returns:
    A new XML reader.
  Throws:
    `SAXException` - If the class cannot be loaded, instantiated, and cast to XMLReader.
  See Also:
    `createXMLReader()`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| JavaTM 2 Platform Std. Ed. v1.4.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2002 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.